﻿using System;
using Autodesk.Revit.DB;

namespace YJKRevitKernel.ElementSearchUtility.LinkDocumentSuite
{
	internal class FilterLimitBean : BaseTransformFilterClass
	{
		internal FilterLimitBean(ElementFilter inputCoreFilter, ViewTransformFilterBean inputViewFilter, Transform inputTransform) : base(inputTransform)
		{
			if (inputCoreFilter == null || inputViewFilter == null)
			{
				throw new System.ArgumentNullException();
			}
			this.m_useCorerFilter = inputCoreFilter;
			this.m_ViewFilterTransform = inputViewFilter;
		}

		internal FilterLimitBean AddTransform(Transform input)
		{
			ViewTransformFilterBean inputViewFilter = this.m_ViewFilterTransform.AddTransform(input);
			Transform addTransform = base.GetAddTransform(input);
			return new FilterLimitBean(this.m_useCorerFilter, inputViewFilter, addTransform);
		}

		internal override ElementFilter GetUseFilter()
		{
			if (!this.IfViewLimit())
			{
				return this.m_useCorerFilter;
			}
			return this.m_ViewFilterTransform.GetUseFilter();
		}

		internal bool IfViewLimit()
		{
			return this.m_ViewFilterTransform.IfViewLimit;
		}

		private ElementFilter m_useCorerFilter;

		private ViewTransformFilterBean m_ViewFilterTransform;
	}
}
